//
//  AllScenicTableViewCell.m
//  DiTripe
//
//  Created by spuer w on 15/12/14.
//  Copyright © 2015年 spuer w. All rights reserved.
//

#import "AllScenicTableViewCell.h"

@implementation AllScenicTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.images.frame = CGRectMake(10, 20, 120, 120);
    self.titleLabel.frame = CGRectMake(self.images.right + 10, 20, self.width - 140, 40);
    self.ratImages.frame = CGRectMake(self.images.right + 10, self.titleLabel.bottom-10, 100, 30);
    self.textsLabel.frame = CGRectMake(self.images.right + 10, self.ratImages.bottom, self.width - 40 - self.images.width, 40);
    
    self.goLabel.frame = CGRectMake(self.images.right + 10, self.height - 20, self.width, 20);
    
    
    
    
}

-(void)setElementModel:(VCsearchElementModel *)elementModel{


    
        if (_elementModel != elementModel) {
            _elementModel = elementModel;
        }
    
    
    [self.images sd_setImageWithURL:[NSURL URLWithString:elementModel.cover_route_map_cover]placeholderImage:[UIImage imageNamed:@"zhanwei"]];
    self.titleLabel.text = elementModel.name;
    self.textsLabel.text = elementModel.recommended_reason;

    self.goLabel.text = [NSString stringWithFormat:@"%@ 人去过", elementModel.visited_count];
    
    
    
    
}


- (void)createView {
    self.images = [[UIImageView alloc]initWithFrame:CGRectZero];
    _images.layer.masksToBounds = YES;
    _images.layer.cornerRadius = 5;
    self.ratImages = [[UIImageView alloc]initWithFrame:CGRectZero];
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    _titleLabel.font = [UIFont boldSystemFontOfSize:20];
    
    
    
    self.textsLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    _textsLabel.font = [UIFont systemFontOfSize:15];
    _textsLabel.textColor = [UIColor grayColor];
    _textsLabel.numberOfLines = 0;
    self.goLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    _goLabel.font = [UIFont systemFontOfSize:15];
    _goLabel.textColor = [UIColor grayColor];
    
    [self addSubview:self.images];
    [self addSubview:self.ratImages];
    [self addSubview:self.titleLabel];
    [self addSubview:self.commentLabel];
    [self addSubview:self.textsLabel];
    [self addSubview:self.goLabel];
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
